Skip to content

fix: keep exported cURL script lines intact and start Windows batch programs safely - #27

Merged
nodemode-ai merged 5 commits into
mainfrom
fix/review-2026-11-28
Nov 29, 2026
Merged

nodemode-ai merged 5 commits into
mainfrom
fix/review-2026-11-28

Conversation

@gbarnai

@gbarnai gbarnai commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

Summary

  • cURL script export (sh, PowerShell, cmd): comments replace every control character, and a flow's method, URL and header names have their line breaks turned into spaces, so each stored value stays on its own command line.
  • cmd scripts: every control character except tab in an argument is replaced before quoting.
  • PowerShell quoting now doubles the typographic single quote marks as well as the ASCII one.
  • Windows: an npm .cmd shim is resolved to its node.exe plus script, or to its exe target, and started directly without cmd.exe, so arguments reach the program as typed.
  • Windows: any other .cmd or .bat program still goes through cmd.exe /c. An argument is refused with a clear message if it holds a control character, %, a double quote, or one of & | < > ^ ( ) ! in a word that will not be quoted. When the program path holds a space, an empty word, a word with a space and an @ in the path are also refused, because cmd would split the path.
  • StartArgv now returns an error. The terminal dock answers 400 with that message, and Run passes it on.
  • Tests: internal/server/curl_export_test.go and internal/agentlookup/winstart_test.go.

Tests

  • Each fix has a test that fails on the previous code where practical.
  • The repo CI commands were run locally on macOS. Every failure seen locally also fails on main in the same environment (missing local tools or platform-specific tests); none is introduced here.
  • Please rely on this PR's CI run for Linux and Windows.

For the owner

  • A few related items need an owner decision; they are listed separately, not here.

How to ship

  • Independent of other repos; merge in any order. No version bump; release as usual.

…L scripts

Comments drop control characters and command arguments turn line breaks into spaces, so a stored value can never start a new script line.
…only words cmd keeps intact

A .cmd shim from npm now runs its node or exe target directly, so a prompt reaches Claude Code as typed. Any other batch file still goes through cmd.exe, and an argument cmd would read differently is refused with a clear message.
…h a space

cmd.exe /c keeps a quoted program path only when it is the one quoted word, so after such a path an empty word, a word with a space or an @ in the path is refused with a clear message.
@gbarnai
gbarnai requested a review from nodemode-ai as a code owner November 29, 2026 18:18
@nodemode-ai
nodemode-ai merged commit 06c8641 into main Nov 29, 2026
5 checks passed
@nodemode-ai
nodemode-ai deleted the fix/review-2026-11-28 branch November 29, 2026 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants